<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.hz.util.ParamUtil"%>
<%@page import="com.hz.model.ApplyAct"%>
<%@page import="com.hz.control.ApplyActControl"%>
<%@page import="com.hz.control.ActTypeControl"%>
<%@page import="com.hz.model.ActType"%>
<%@page import="com.hz.model.User"%>
<%@page import="com.hz.model.ParamDepartment"%>
<%@page import="com.hz.control.ParamDepartmentManager"%>
<%@page import="com.hz.control.ApplyActControl"%>
<%@page import="com.hz.control.UserControl"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'index.jsp' starting page</title>
  </head>
  <link rel="stylesheet" type="text/css" href="../../../css/active.css"/>
   <link rel="stylesheet" href="../../../kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="../../../kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="../../../kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="../../../kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../../../kindeditor/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : '../../../kindeditor/plugins/code/prettify.css',
				uploadJson : '../../../kindeditor/jsp/upload_json.jsp',
				fileManagerJson : '../../../kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
  <body>
  <%
      request.setCharacterEncoding("utf-8");
      String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
       User user = (User)session.getAttribute("user");
      int acid = ParamUtil.getInt(request,"acid");
      ApplyAct a = ApplyActControl.getActivityInformation(acid);
   %>
   <form action="ApplyActivity_update_do.jsp?acid=<%=acid %>" method="post">
  <table class='add' style="width:500px;">
  <tr><td width='80'>活动名称</td><td width='140'><input type="text" name="name" value="<%=a.getName() %>"/></td>
<td>活动类型</td><td><select name="actType">
  <%
       Collection<ActType> atps = ActTypeControl.getAllActTypes();
       Iterator<ActType> it = atps.iterator();
       while(it.hasNext()){
       ActType at =  it.next();
   %>
   <option value="<%=at.getId() %>" <%if(at.getId()==a.getActType()) out.print("selected='selected'"); %>><%=at.getTypeName() %></option>
   <%} %>
  </select></td></tr>
 <tr><td>活动目的</td><td><input type="text" name="purpose" value="<%=a.getName() %>" /></td>
 <td>面向对象</td><td><input type="text" name="object" value="<%=a.getObject() %>"/></td>
  </tr><tr>
  <td>负责人</td><td><input type="text" name="leader" value="<%=a.getLeader() %>"/></td>
  <td>联系方式</td><td><input type="text" name="contact" value="<%=a.getContact() %>"/></td></tr>
  
  <tr><td>举办时间</td><td><input type="text" name="holdTime" value="<%=a.getHoldTime() %>"/></td>
  <td>经费</td><td><input type="text" name="budget" value="<%=a.getBudget() %>"/>元</td>
  </tr><tr>
  <td>备注</td><td colspan="3"><textarea style='width:100%;' name="notes"/><%=a.getNotes() %></textarea></td></tr>
  
  <tr>
	    <td colspan="4"><%=htmlData%>
		<textarea name="content1" cols="100" rows="8" style="width:498px;height:300px;visibility:hidden;"><%=htmlspecialchars(htmlData)%><%out.println(a.getProcedure());%></textarea>
		<br /></td></tr>
 <tr><td><input type="hidden" name="userId"value="<%=user.getId()%>"/></td>
<td><input type="submit" value="提交"/></td>
<td><input type="reset" value="重置"/></td>
</tr>
  </table>
  </form>
  </body>
</html>
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>